package com.etime.shycourse.controller.wx.index;

import com.etime.shycourse.dto.WXOffLineCourseShowDto;
import com.etime.shycourse.pojo.Course;
import com.etime.shycourse.pojo.Sysbanner;
import com.etime.shycourse.services.wxcourselist.WXIndexPageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 微信小程序首页相关数据接口controller类
 */
@Api(tags = "微信-小程序首页相关数据接口")
@RestController
@RequestMapping("/wx/index")
public class WXIndexPageController {

    @Autowired
    private WXIndexPageService wxIndexPageService;

    @ApiOperation("首页-获取banner图列表数据接口")
    @GetMapping("/banners")
    public List<Sysbanner> selectSysBannerList(){
        return wxIndexPageService.selectSysBannerList();
    }

    @ApiOperation("首页-获取线下课程列表数据接口(设置为推荐，发布，审核通过会显示；并按照排序字段降序排列)")
    @GetMapping("/offline")
    public List<WXOffLineCourseShowDto> selectOffLineCourseList(){
        return wxIndexPageService.selectOffLineCourseList();
    }
    @ApiOperation("首页-获取精品推荐课程数据接口(设置为推荐，发布，审核通过，评分>9；并按照评分和排序字段降序排列)")
    @GetMapping("/recommend")
    public List<Course> selectRecommendCourseList(){
        return wxIndexPageService.selectRecommendCourseList();
    }
}
